﻿@using GSLMS.Entity
@using GSLMS.Entity.Enum
@model IEnumerable<GSLMS.Entity.TB_APP_PROINFO>
@{
    Layout = null;
    int i = 1;
    var SearchParma = ViewData["SearchParma"] as GSLMS.Entity.TB_APP_PROINFO ?? new GSLMS.Entity.TB_APP_PROINFO();
    var ddlDepID = ViewData["DepID"] as SelectList;
    var ddlProduct = ViewData["Product"] as SelectList;
    var ddlStatus = ViewData["Status"] as SelectList;

    SearchParma.APPDATE = DateTime.Now.AddMonths(-1);
    SearchParma.APPDATE_END = DateTime.Now;    
}
<form id="pagerForm" method="get" action="DianDang/FKAudit/RiskControl/index?action=page&OpID=@ViewData["OperateID"]">
<input type="hidden" name="pageNum" value="1" />
<input type="hidden" name="numPerPage" value="@ViewData["pageSize"]" />
<input type="hidden" name="RowCount" value="@ViewData["RowCount"]" />
<input type="hidden" name="DEPID" value="@SearchParma.DEPID" />
<input type="hidden" name="PRODUCTID" value="@SearchParma.PRODUCTID" />
<input type="hidden" name="RiskAuditStatus" value="1"/>
<input type="hidden" name="RiskAuditStatus2" value="@SearchParma.RiskAuditStatus2" />
<input type="hidden" name="STATUS" value="@SearchParma.STATUS" />
</form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this)" id="Form_@ViewData["CurrentController"]" action="DianDang/FKAudit/RiskControl/index?action=search&OpID=@ViewData["OperateID"]"
    method="post">
    <div class="searchBar">
        <table class="searchContent">
            <tr>
                <th>
                    客户名称：
                </th>
                <td>
                    @Html.TextBox("CUSTNAME", SearchParma.CUSTNAME, new { @style="width:100px;"})
                </td>
                <th>
                    所属部门：
                </th>
                <td>
                    @Html.DropDownList("DepID", ddlDepID, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @style = "width:100px;" })
                </td>
                <th>
                    贷款产品:
                </th>
                <td>
                    @Html.DropDownList("ProductID", ddlProduct, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @style = "width:80px;" })
                </td>
                <th>
                    处理状态:
                </th>
                <td>
                    <input type="checkbox" name="RiskAuditStatus" value="1" @(SearchParma.RiskAuditStatus==1?"checked='checked'":"")  />
                    <span>未处理</span>
                    <input type="checkbox" name="RiskAuditStatus2" value="1" @(SearchParma.RiskAuditStatus2== 1 ? "checked='checked'" : "")  />
                    <span>已处理</span>
                </td>
                <th>
                    贷款状态:
                </th>
                <td>
                    @Html.DropDownList("Status", ddlStatus, GSLMS.WebAPP.HelperCommon.SelectDefaultValue, new { @style = "width:80px;" })
                </td>
                <td align="right">
                    <div class="subBar">
                        <ul>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="submit" name="submit">
                                            检索</button></div>
                                </div>
                            </li>
                            <li>
                                <div class="buttonActive">
                                    <div class="buttonContent">
                                        <button type="reset" name="reset">
                                            重置</button></div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    </form>
</div>
<div class="pageContent">
    @Html.Partial("Buttons")
    <table class="list" layouth="120" id="tableRiskProInfoList">
        <thead>
            <tr class="header">
                <th style="width:80px;">
                    申请编号
                </th>
                <th style="width:135px;">
                    客户名称
                </th>
                <th style="width:80px;">
                    项目经理
                </th>
                <th style="width:100px;">
                    所属部门
                </th>
                <th style="width:80px;">
                    贷款产品
                </th>
                <th style="width:100px;">
                    申请额度(万元)
                </th>
                <th style="width:80px;">
                   申请日期
                </th>
                <th style="width:100px;">
                    处理日期
                </th>
                <th style="width:80px;">
                    贷款状态
                </th>
            </tr>
        </thead>
        @foreach (var item in Model)
        {            
            <tr target="RiskControl_id" rel="@item.ID" BUSSTYPE="@item.BUSSTYPE" REGINFOID="@item.REGINFOID"  RISKAUDITSTATUS="@item.RiskAuditStatus">
                <td>
                    <a href="DianDang/Apply/ProInfo/Details/@item.ID?OpID=@ViewData["OperateID"]" Target="dialog"   title="查看立项申请【@item.CUSTNAME】">
                        @item.APPLYNO
                    </a>
                </td>
                <td>
                    @item.CUSTNAME
                </td>
                <td style="text-align:center;">
                    @item.SALESMAN
                </td>
                <td style="text-align:center;">@item.DEPNAME
                </td>
                <td style="text-align:center;">@item.PRODUCTNAME
                </td>
                <td style="text-align:right;">@item.AMOUNT.ToString("N")
                </td>
                <td style="text-align:center;">
                    <span formatedate="yyyy-MM-dd">@item.APPDATE.Value.ToString("yyyy-MM-dd")</span>
                </td>
                <td style="text-align:center;">
                   <span formatedate="yyyy-MM-dd">@(item.RiskAuditStatus == 1 ? item.AduRiskControl.AUDITTIME.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")</span>
                </td>
                <td style="text-align:center;">
                    @((ApplyEnum.ProStatus)item.STATUS)
                </td>
            </tr>
            i += 1;
        }
    </table>
</div>
@Html.Partial("PageBar")
<script type="text/javascript">
    function toCreate(obj) {
        $this = $(obj);
        var id = $("#tableRiskProInfoList").find(".selected").attr("rel");
        if (id) {
            var BussType = $("#tableRiskProInfoList").find(".selected").attr("BUSSTYPE");
            var riskStatus = $("#tableRiskProInfoList").find(".selected").attr("RISKAUDITSTATUS");
            var url = "DianDang/FKAudit/RiskControl/CreateUnHouInfo/" + id+"?riskstatus="+riskStatus;
            var title = "调查报告"
            var rel = "DianDang_FKAudit_RiskControl_1";
            var options = {};
            if (BussType && BussType == 3) {
                title = "调查报告";
                url = "DianDang/FKAudit/RiskControl/CreateHouInfo/" + id+"?riskStatus="+riskStatus;
            }
            $.pdialog.open(url, rel, title, options);
        }
        else {
            alertMsg.error("请选择一条记录");
        }
    }

    function toShowRegLog(obj) {
        $this = $(obj);
        var id = $("#tableRiskProInfoList").find(".selected").attr("rel");
        if (id) {
            var reginfoID = $("#tableRiskProInfoList").find(".selected").attr("REGINFOID");
            var url = "DianDang/Apply/ApplyList/RegLog/" + reginfoID + "?logOnly=1";
            var title = "查看日志"
            var rel = "DianDang_Apply_ApplyList_4";
            var options = {};
            
            $.pdialog.open(url, rel, title, options);
        }
        else {
            alertMsg.error("请选择一条记录");
        }
    }

    function toFlowBack(obj) {
        $this = $(obj);
        var id = $("#tableRiskProInfoList").find(".selected").attr("rel");
        if (id) {
            var riskStatus = $("#tableRiskProInfoList").find(".selected").attr("RISKAUDITSTATUS");
            var url = "DianDang/FKAudit/RiskControl/BackTo/" + id;
            if (riskStatus && riskStatus == 1)
                alertMsg.error("此立项申请已经提交了审批，不允许再退回。");
            else {
                var v = alertMsg.confirm("");
                //var back = ajaxTodo(url, "forwardConfirmMsg", "您确定要退回此笔立项申请信息吗?");
                ajaxTodo(url, "navTabAjaxDone");
            }
        }
        else {
            alertMsg.error("请选择一条记录");
        }
    }
  
</script>
